package com.health.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.health.constant.MessageConstant;
import com.health.dao.RoleDao;
import com.health.entity.Result;
import com.health.pojo.Role;
import com.health.service.RolesService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Classname RolesServiceImpl
 * @Description TODO
 * @Version 1.0.0
 * @Date 2023/3/18 9:13
 * @Author RainGrd
 */
@Service(interfaceClass = RolesService.class)
@Transactional
@Slf4j
public class RolesServiceImpl implements RolesService {

    @Autowired
    private RoleDao roleDao;

    @Override
    public Result queryAll() {
        List<Role> roles = roleDao.selectAll();
        return roles.size() > 0 ? Result.success(roles, MessageConstant.GET_ROLE_SUCCESS) : Result.error(MessageConstant.GET_ROLE_FAIL);
    }
}
